/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.javanile.chess.stone;

/**
 *
 * @author totalinnovation
 */
public class List {
    public byte[] from;
    public byte[] to;
    private int	   index;
    private String info;

    public int	caret;
    public byte a_from;
    public byte a_to;

    public List() {
	from = new byte[100];
	to   = new byte[100];
	index= 0;
	info = "";
	caret= -1;
    }
    public void add(byte f, byte t) {
	from[index] = f;
	to  [index] = t;
	index++;
    }
    public void add(int f, int t) {
	from[index] = (byte)f;
	to  [index] = (byte)t;
	index++;
    }
    public void setInfo(String i) {
	info = i;
    }
    public String getInfo() {
	return info;
    }
    public void dump() {
	for(int i=0;i<index;i++) {
	    if ((i%8==0)&&(i>0)) {
		System.out.print("\n");
	    }
	    System.out.print(Less.move(from[i],to[i])+" ");
	}
	System.out.print("\n");
    }
    public boolean next() {
	caret++;
	a_from = from[caret];
	a_to = to[caret];
	return caret<index;
    }
    public int[] get(int n) {
	return new int[] {from[n],to[n]};
    }
    public int size() {
	return index;
    }
    public int[] move() {
	return new int[] {from[caret],to[caret]};
    }
}
